from pygamenet import *

# Packets
#COMMAND_LOGIN = 400
#COMMAND_SERVER_VERSION = 10
#COMMAND_CARD_MOVE = 1
#COMMAND_CARD_ADD = 2
#COMMAND_CARD_DELETE = 3
#COMMAND_CARD_ROTATE = 4
#COMMAND_CARD_FLIP = 5

COMMAND_LOGIN = 'COMMAND_LOGIN'
COMMAND_SERVER_VERSION = 'COMMAND_SERVER_VERSION'
COMMAND_CARD_MOVE = 'COMMAND_CARD_MOVE'
COMMAND_CARD_ADD = 'COMMAND_CARD_ADD'
COMMAND_CARD_DELETE = 'COMMAND_CARD_DELETE'
COMMAND_CARD_ROTATE = 'COMMAND_CARD_ROTATE'
COMMAND_CARD_FLIP = 'COMMAND_CARD_FLIP'

msgs = [
    (1, ''),
    (2, ''),
    (3, 's'),
    (4, 'hff'),
    (5, 'hfffffffff'),
    (6, 'shh'),
    (7, ''),
]


def sentPacket(packetType, body, connection):
    if connection:
#        connection.send_object( (packetType, body) )
        message = Message(packetType)
#        message.append(body)
#        board_state = "Hello world!"
        for body_element in body:
            message.append(body_element)
        print "Message to send:", message
        connection.broadcast(message)
